<?php

namespace App\Services\Admin;

use App\Services\Service;
use App\Models\Log;

class LogService extends Service
{

    public static function index(array $params): array
    {

        $query = Log::query()->orderBy('id', 'desc');

        $pageNum = $params['pageNum'];
        $pageSize = $params['pageSize'];

        $paginator = $query->paginate($pageSize, ['*'], 'page', $pageNum);

        $paginator->getCollection()->makeVisible(['createTime', 'updateTime']);

        return [
            'list'  => $paginator->items(),
            'total' => $paginator->total(),
        ];
    }
}
